//
//  AVPlayerMagnifiedManager.m
//  RainbowFM
//
//  Created by Kratos on 14/12/10.
//  Copyright (c) 2014年 RB. All rights reserved.
//

#import "AVPlayerMagnifiedManager.h"
#import <MediaPlayer/MediaPlayer.h>

@interface DirectionMPMoviePlayerViewController : MPMoviePlayerViewController
@end

@implementation DirectionMPMoviePlayerViewController
-(void)viewDidLoad
{
    [super viewDidLoad];
    
    CGAffineTransform transform = CGAffineTransformMakeRotation(M_PI/2);
    [self.view setTransform:transform];
}


@end

@implementation AVPlayerMagnifiedManager

-(void)play
{
    if (!_manager || ![_manager isKindOfClass:[UIViewController class]] || !_avdata) {
        return;
    }
    UIViewController *manager = (UIViewController *)_manager;
    
    NSURL *url = [NSURL URLWithString:_avdata[@"path"]];
    DirectionMPMoviePlayerViewController *moviePlayer = [[DirectionMPMoviePlayerViewController alloc]initWithContentURL:url];
    moviePlayer.moviePlayer.scalingMode = MPMovieScalingModeAspectFit;
    moviePlayer.moviePlayer.controlStyle = MPMovieControlStyleFullscreen;

    [manager presentViewController:moviePlayer animated:NO completion:nil];
}

@end
